#ifndef GAME_H
#define GAME_H

#ifdef __APPLE__
	#include "OpenGL/gl.h"
	#include "OpenGL/glu.h"
	#include <GLUT/glut.h>
#else
#ifdef WIN32
	#include <windows.h>
#endif
	#include <GL/gl.h>
	#include <GL/glu.h>
	#include <GL/glut.h>
#endif

#include <list>
#include <queue>

#include "../chipmunk/chipmunk.h"

#include "drawable.h"
#include "updateable.h"
#include "physicsable.h"
#include "spawnable.h"

#include "gameObject.h"

#include "block.h"
#include "ship.h"
#include "camera.h"
#include "background.h"
#include "input.h"

//Holds and implements all the objects in the game
class Game {
private:
	Input input_; //Input class

	Ship test_;

	Camera testCam_;

	Background bg_;

	//Object lists
	std::list<Drawable*> drawables;
	std::list<Updateable*> updateables;
	std::queue<GameObject*> spawnables;

	//Our object list for physicsables
	cpSpace* space_;
	
	void add(GameObject* o);
	void addDrawable(Drawable* pD);
	void addUpdateable(Updateable* pU);
	void addPhysicsable(Physicsable* pP);

	void drawStep();
	void updateStep();
	void physicsStep();
	void spawnStep();

	void doInput();

	void init();
	  
public:
	//Constructor
    Game(int width, int height)
        : test_(10.0),
		  testCam_(cpv(0.0, 0.0), width, height),
		  bg_(),
		  drawables(),
		  updateables(),
		  spawnables(),
		  space_(cpSpaceNew()) {
        init();
    }

	inline Input& getInputClass() {return input_;}
	
	void step();
};

#endif
